package cn.wh.transaction.jdbc;

import cn.wh.session.TransactionIsolationLevel;
import cn.wh.transaction.Transaction;
import cn.wh.transaction.TransactionFactory;

import javax.sql.DataSource;
import java.sql.Connection;

/**
 * @Author: wh
 * @CreateTime: 2023-01-17  15:01
 * @Description: JdbcTransaction 工厂
 * @Version: 1.0
 */
public class JdbcTransactionFactory implements TransactionFactory {
    @Override
    public Transaction newTransaction(Connection connection) {
        return new JdbcTransaction(connection);
    }

    @Override
    public Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit) {
        return new JdbcTransaction(dataSource,level,autoCommit);
    }
}
